import sys
import os
import pylab as plt
from params import *


f1 = os.path.join(WORKDIR, 'geocascades', 'results',
    'twitter_edge_distance_cdf.txt')
f2 = os.path.join(WORKDIR, 'geocascades', 'results',
    'twitter_step_distance_cdf.txt')

x_edge,y_edge = [],[]
for line in open(f1):
    x,y = map(float,line.split())
    x_edge.append(x)
    y_edge.append(y)

x_step,y_step = [],[]
for line in open(f2):
    x,y = map(float,line.split())
    x_step.append(x)
    y_step.append(y)

plt.figure()
plt.clf()
plt.axes(FIG_AXES2)
plt.semilogx(x_edge,y_edge,'k-')
plt.semilogx(x_step,y_step,'k--')
plt.legend(['Social link','Cascade step'],
        numpoints=1,loc='upper left')
plt.ylabel('CDF')
plt.xlabel('Distance [km]')
plt.grid(True)
plt.savefig('cascade_edge.pdf')
plt.close()
